/*
 * File Name:               UIAnimator.cs
 * 
 * Description:             普通类
 * Author:                  lisiyu <576603306@qq.com>
 * Create Date:             2017/01/20
 */

using System;
using System.Collections;
using UnityEngine;

[RequireComponent(typeof(Animator))]
public class UIAnimator : MonoBehaviour
{
    private Action mCallback;
    private Animator mAnimator;
    void Awake()
    {
        mAnimator = GetComponent<Animator>();
    }

    private void Start()
    {
        mAnimator.Update(0);
    }

    public void onClose(Action callback)
    {
        mAnimator.SetTrigger("Exit");
        mCallback = callback;
    }

    public void SetTrigger(string trigger)
    {
        mAnimator.SetTrigger(trigger);
    }

    public void onResRecycle()
    {
        if (mCallback != null)
            mCallback();
    }
}
